﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ue.Infrastructure.DomainBase;
using Ue.Infrastructure.RepositoryFramework;

namespace Ue.Qcdz.Domain.Adver
{
    public class AdvertisementService
    {
        private static IAdvertisementRepository _repository;
        static AdvertisementService()
        {
            _repository = RepositoryFactory.GetRepository<IAdvertisementRepository, Advertisement>();
        }
        public static Advertisement GetAdvertisement(object advertisementsionsKey)
        {
            return AdvertisementService._repository.FindBy(advertisementsionsKey);
        }
        public static IList<Advertisement> GetAdvertisement()
        {
            return AdvertisementService._repository.FindAll();
        }
        public static IDataResult<Advertisement> GetAdvertisements(IDataQuery dataQuery)
        {
            return AdvertisementService._repository.FindBy(dataQuery);
        }
        public static void AddAdvertisement(Advertisement advertisement)
        {
            AdvertisementService._repository.Add(advertisement);
        }
        public static void UpdateAdvertisement(Advertisement advertisement)
        {
            AdvertisementService._repository[advertisement.Key] = advertisement;
        }
    }
}
